//
//  TopicDetailViewController.m
//  SimpleTimeDemo
//
//  Created by lanou3g on 15/11/17.
//  Copyright © 2015年 王丽珍. All rights reserved.
//

#import "TopicDetailViewController.h"
#import "MainDataHelper.h"
#import "TopicModel.h"

@interface TopicDetailViewController ()

@property (nonatomic, strong) NSMutableArray *dataArray;

@property (nonatomic, copy) NSString *string;
@property (nonatomic, copy) NSString *bodyString;

@property (nonatomic, strong) UIWebView *webView;

@end

@implementation TopicDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
#pragma mark --- webview ---
    self.webView = [[UIWebView alloc] initWithFrame:self.view.frame];
    
    [self.view addSubview:self.webView];
    
    self.string = @"http://api2.pianke.me/article/info";
    self.bodyString = [NSString stringWithFormat:@"auth=W8Um3Eiixm3qtDC8h8GcDrlDJxQMeoN76M8GxpD2Qm3cWP22NFFQx1a7Ps&client=1&contentid=%@&deviceid=70D20EF9-AB8B-42FD-937C-7D884DB58895&version=3.0.6",self.contentid];
    [MainDataHelper postDataWithUrlString:self.string andBodyString:self.bodyString compare:^(id object) {
        NSDictionary *dic = object;
        TopicModel *model = [[TopicModel alloc] init];
        model.html = dic[@"data"][@"html"];
        [self.webView loadHTMLString:model.html baseURL:nil];
    }];
    
//    UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.frame];
//    NSURL *url = [NSURL URLWithString:self.urlString];
//    NSURLRequest *request = [NSURLRequest requestWithURL:url];
//    
//    webView.scalesPageToFit = YES;
//    
//    [self.view addSubview:webView];
//    [webView loadRequest:request];
}













- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
